#!/bin/bash

echo "🔨 测试项目构建..."

echo "📦 检查依赖..."
npm list --depth=0

echo ""
echo "🔨 构建项目..."
npm run build

if [ $? -eq 0 ]; then
    echo "✅ 构建成功！"
    
    echo ""
    echo "🧪 运行基本测试..."
    npm test -- --passWithNoTests --testNamePattern="应该被定义"
    
    echo ""
    echo "🚀 项目已准备就绪！"
    echo "运行以下命令启动应用："
    echo "  npm run start:dev    # 开发模式"
    echo "  npm run start:prod   # 生产模式"
    echo "  npm test            # 运行所有测试"
else
    echo "❌ 构建失败！"
    exit 1
fi
